<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>基础数据</title>
    <s:head/>
</head>
<script type="text/javascript">
    var id = "${ID}";
    // 	有多个页面会用到这个页面，pageType用来标识页面，D为在线下单报关单,all为全部
    var pageType = "${pageType}"
    var gridTitle = "";
    if (id) {
        gridTitle = "修改数据";
    } else {
        gridTitle = "添加数据";
    }
    var formSetting = {
        title: "基础数据",
        module: 'save',
        numCount: 1,
        buttons: {
            'custom': [

// 			          {
// 			        	  id: "saveButton",
// 			        	  value:"保存"
// 			          },
                {
                    id: "cancelbtn",
                    value: "取消",
                    click: function () {
                        if (pageType == "all" || pageType == "withD") {
                            window.parent.location.href = "business-businessList";
                        } else if (pageType == "D") {
                            window.parent.location.href = "declaration-main";
                        } else {
                            jw.close();
                        }
                    }
                }
            ]
        },

        columns: [{
            name: "declarationInform.sendRemind.id",
            label: "id",
            hidden: true
        }, {
            name: "declarationInform.sendRemind.expressNo",
            label: "快递单号"
        }, {
            name: "declarationInform.sendRemind.expressCompanyName",
            label: "快递公司名称"
        }, {
            name: "declarationInform.sendRemind.mailFileContents",
            label: "邮寄文件内容",
        }, {
            name: "declarationInform.sendRemind.remark",
            label: "备注",
            type: "textarea"
        }, {
            name: "declarationInform.sendRemind.businessNo",
            label: "业务编号",
            hidden: true
        }],
        form: {
            'url': 'sendremind-saveOrUpdate?id=' + id,
            'data': function () {
                if (id) {
                    var dataValue = "";
                    $.ajax({
                        url: "sendremind-find?sendRemind.id=" + id,
                        async: false,
                        cache: false,
                        success: function (data) {
                            dataValue = data;
                        }
                    });
                    return dataValue;
                } else {
                    return null;
                }
            },
// 			'afterAjaxSuccess' : function(responseText, statusText, xhr, $form) {
// 				jw.close();
// // 				alert(1);
// 				$('#center', window.parent.document).attr("src","declarationInform-main")
// // 				location.href="declarationInform-main";
// 			}

            'ajaxForm': {
                success: function () {
                    if (pageType == "business" || pageType == "all" || pageType == "withD") {
                        window.parent.location.href = "business-businessList";
                    } else if (pageType == "D") {
                        window.parent.location.href = "declaration-main";
                    }
                    jw.close();
// 					window.location.href="declaration-main";
// 					jw.close();
// 					history.back();
                }
            },

        }
    };
    $(document).ready(function () {
        $("#formtable").mrdForm(formSetting);
    });
</script>
<body>
<div style="width: 100%">
    <div id="formtable"></div>
</div>
</body>
</html>
